def collatz(n):
    if n % 2 == 0: return n/2
    else: return 3*n + 1

def collatzSeq(n):
    seq = [n]
    while seq[-1] > 1:
        seq.append(collatz(seq[-1]))
    return seq

maxSeq = []
for i in xrange(0,999999):
    seq = collatzSeq(i)
    #print seq[0], 
    if len(seq) > len (maxSeq): maxSeq = seq

        
print maxSeq
